package ar.uade.distribuidas.tpo.dba.dao;

import org.hibernate.Session;

import ar.uade.distribuidas.tpo.dba.hbt.HibernateDAO;

public class FacturaDAO extends HibernateDAO {

	private static FacturaDAO instance;

	private FacturaDAO() {
		super();
	}

	public static FacturaDAO getInstance() {
		if (instance == null) {
			instance = new FacturaDAO();
		}
		return instance;
	}

	public int getLastNumber() {
		int r = (int) this.getSession().createQuery("select COALESCE(MAX(numeroFactura), 0) from Factura").uniqueResult();
		return r;
	}
	
}
